package mybatis.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import mybatis.entity.Game;
import mybatis.service.FeatureService;
import mybatis.service.GamesService;
import mybatis.service.impl.FeatureServiceImpl;
import mybatis.service.impl.GamesServiceImpl;

@WebServlet("/game/*")
public class GameDetailServlet extends BaseServlet {
	public void findDetailById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String gid = request.getParameter("gid");
		GamesService service = applicationContext.getBean("gamesServiceImpl", GamesServiceImpl.class);
		Game game = service.findWholeGameById(Integer.parseInt(gid));
		request.setAttribute("game", game);
		request.getRequestDispatcher("/pages/detail.jsp").forward(request, response);
	}
}
